package cn.faifai.tagapi.utils.recycleBinPath.impl;

import cn.faifai.framework.conditional.WindowsCondition;
import cn.faifai.framework.utils.fetcher.SidFetcher;
import cn.faifai.tagapi.utils.recycleBinPath.RecycleBinPathFetcher;
import org.springframework.context.annotation.Conditional;
import org.springframework.stereotype.Component;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

@Component
@Conditional(value = WindowsCondition.class)
public class WindowsRecycleBinPath implements RecycleBinPathFetcher {

    @Override
    public List<String> getRecycleBinPath() {
        File[] roots = File.listRoots();
        String sid = SidFetcher.getSid();
        ArrayList<String> paths = new ArrayList<>();
        for (File root : roots) {
            String path = root.getPath() + "\\$RECYCLE.BIN\\" + sid + "\\";
            paths.add(path);
        }
        return paths;
    }
}
